package com.yigang.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.yigang.dao.OrderdetailsDao;
import com.yigang.entity.Orderdetails;

import com.yigang.service.OrderdetailsService;
import com.yigang.utils.ResultUtil;
@Service
@Transactional
public class OrderdetailsServiceImpl implements OrderdetailsService{

	@Autowired
	private OrderdetailsDao orderdetailsDao;
	@Override
	public ResultUtil selectOrderdetailsList(Integer page, Integer limit, Orderdetails record) {
		// TODO Auto-generated method stub
		PageHelper.startPage(page, limit);
		List<Orderdetails> orderdetails = orderdetailsDao.selectOrderdetailsList(record);
		PageInfo<Orderdetails> pageInfo = new PageInfo<Orderdetails>(orderdetails);
		ResultUtil resultUtil = new ResultUtil();
		resultUtil.setCode(0);
		resultUtil.setCount(pageInfo.getTotal());
		resultUtil.setData(pageInfo.getList());
		return resultUtil;
	}

	@Override
	public ResultUtil deleteByPrimaryKey(Integer orderdetails_id) {
		// TODO Auto-generated method stub
		orderdetailsDao.deleteByPrimaryKey(orderdetails_id);
		return ResultUtil.ok();
	}

	@Override
	public ResultUtil insertSelective(Orderdetails record) {
		// TODO Auto-generated method stub
		orderdetailsDao.insertSelective(record);
		return ResultUtil.ok();
	}

	@Override
	public ResultUtil updateByPrimaryKeySelective(Orderdetails record) {
		// TODO Auto-generated method stub
		orderdetailsDao.updateByPrimaryKeySelective(record);
		return ResultUtil.ok();
	}

	@Override
	public Orderdetails selectOrderdetailsById(int orderdetails_id) {
		// TODO Auto-generated method stub
		return orderdetailsDao.selectOrderdetailsById(orderdetails_id);
	}

	

}
